package com.example.config;

import feign.Logger;
import feign.Retryer;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
import reactor.util.retry.Retry;

@Configuration
public class OrderConfig {

    /**
     * 重试机制，当发生
     * @return
     */
    @Bean
    Retryer retryer() {
        // Default(最短间隔，最长间隔，尝试次数)
        return new Retryer.Default();
    }

    @Bean
    Logger.Level feignLoggerLevel() {
        return Logger.Level.FULL;
    }

    @LoadBalanced
    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

//    @Bean
//    public LoadBalancerClient loadBalancerClient() {
//        return
//    }
}
